<?php

namespace App\Http\Requests\Hr;

use App\Http\Requests\BaseRequest;

class SignupRequest extends BaseRequest {

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'mobile' => 'required|digits:11|hrMobileUnique',
            'password' => 'required|between:6,20'
        ];
    }

    public function messages()
    {
        return [
            'mobile.required' => '手机号码不能为空',
            'mobile.digits' => '手机号码不正确',
            'mobile.hr_mobile_unique' => '这个手机号已经注册过了',
            'password.required' => '密码不能为空',
            'password.between' => '密码长度需要在 :min - :max 位之间'
        ];
    }
}